// pages/ledger/day/index.js
var fileManager = require('../../libs/fileManager');
Page({

	/**
	 * 页面的初始数据
	 */
	data: {
		list: [
			// {
			// 	id: 1,
			// 	datetime: "2020-20-20 20:20:20",
			// 	time: "20:20:20",
			// 	purpose: "买烟黄鹤楼",
			// 	money: 17,
			// 	author: "小李同学",
			// }
		]
	},
	onPullDownRefresh() {
		this.getList()
		setTimeout(() => {
			my.stopPullDownRefresh()
		}, 1000);
	},
	/**
	 * 生命周期函数--监听页面加载
	 */
	onLoad(options) {
		this.getList()
	},
	getList() {
		fileManager.getTodayDataJS().then(res => {
			console.log(res)
			this.setData({
				list: [...res.data]
			})
		})
	},
	back() {
		my.navigateBack()
	},
	getDetail(e) {
		let item = e.currentTarget.dataset.item
		console.log("入账明细", item)
		my.showModal({
			title: `${item.time}消费明细`,
			content: `${item.authorLabel}【${item.purpose}】，本次消费${item.money}元`,
			showCancel: false,
			confirmText: "团团收到",
			confirmColor: "#0fc75b",
			complete: (res) => {
				console.log(res)
			}
		})
	}
})